import React, { Component } from 'react'
import {ButtonStyle} from './Button.style'

export default class Button extends Component {


  handleClik=()=>{
    if(this.props.type==='increment'){
      this.props.change(1)
    }else{
      this.props.change(-1)
    }
  }

  render() {
    let color = this.props.type==='increment'?'green':'red';
    return (
      <ButtonStyle bg={color} onClick={this.handleClik}>
       {this.props.children}
      </ButtonStyle>
    )
  }
}
